<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="http://www.shitou.com" %>
<%@ include file="base.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=GBK" />
	<title>任务页</title>
	<link rel="stylesheet" type="text/css" href="style/reset.css" media="all" />
	<link rel="stylesheet" type="text/css" href="style/layout.css" media="all" />
	<link rel="stylesheet" type="text/css" href="style/invalid.css" media="all" />
	<link rel="stylesheet" type="text/css" href="style/style.css" media="all" />
	<script type="text/javascript" src="script/jquery-1.4.3.min.js"></script>
	<script type="text/javascript" src="script/jquery.mousewheel-3.0.4.pack.js"></script>
	<script type="text/javascript" src="script/jquery.tipTip.minified.js"></script>
	<script type="text/javascript" src="script/simpla.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#main-nav-a-list").addClass("current");
			$("#main-nav-a-list").next("ul").show();
			$("#subbutton").click(function(){
				var content = $("#commentcontent").val();
				if(content.trim().length == 0) {
					$("#notifyMessage div").html("请输入评论内容后发表！").parent().slideDown().show().fadeTo(400,1);
				} else {
					$("#commentform").submit();
				}
			});
		});
	</script>
</head>
<body>
	<div id="body-wrapper">
		<!-- sidebar开始 -->
		<%@ include file="left.jsp" %>
		<!-- sidebar结束 -->
		<!-- main-content开始 -->
		<div id="main-content">
			<div class="content-box closed-box">
				<div class="content-box-header">
					<h3><a href="index.jspx">首页</a>&gt<a href="${basePath}/project.jspx?id=${issues.project.id}">${issues.project.name}</a>&gt ${issues.title}
					</h3>
				</div>
			</div>
			
			<!-- 任务开始 -->
			<div class="column-large-left">
				<div class="content-box">
					<div class="content-box-header">
						<h3><img src="task.png"/>${issues.title}</h3>
					</div>
					<div class="content-box-content" style="padding-bottom: 10px;">
						<div style="display: block;" class="tab-content default-tab">
							${issues.content}							
							<p class="msg_p">${issues.user.name } 更新于 30分钟前</p>
						</div>
					</div> 
				</div>
				
				<div class="content-box">
					<div class="content-box-header">
						<h3>当前讨论</h3>
					</div>
					<div class="content-box-content" style="padding-bottom: 10px;">
						<div style="display: block;" class="tab-content default-tab">
							<c:forEach items="${issues.comments}" var="comment">
								<div class="me_message">
									<div class="pic">
										<img src="${basePath }/images/default-pic.jpg" width="36" height="36" />
									</div>
									${comment.content}
									<p>${comment.user.name } 更新于 ${comment.createdate}</p>
								</div>
							</c:forEach>
							<form id="commentform" action="comment!issuesSave.jspx" method="post">
								<!-- 错误消息开始 -->
								<div id="notifyMessage" class="notification attention png_bg" style="opacity: 0; display: none;">
									<a class="close" href="#">
										<img alt="close" title="Close this notification" src="${basePath }/images/cross_grey_small.png" />
									</a>
									<div>
									</div>
								</div>
								<!-- 错误消息结束 -->
								<input type="hidden" name="issues.id" value="${issues.id}"/>
								<textarea id="commentcontent" name="comment.content"></textarea>
								<input id="subbutton" type="button" value="参与讨论" class="button" style="margin-top:10px;"/>
							</form>
						</div>
					</div> 
				</div>
				
				
			</div>

			<c:if test="${issues.assignment != null}">
			<div class="content-box column-small-right">
				
				<div class="content-box-header">
					<h3 style="cursor: s-resize;">当前状态　　<c:if test="${issues.assignment != null}"><s:issues_state_span state="${issues.assignment.state}"/></c:if> </h3>
				</div>
				
				<div class="content-box-content">
					
					<div style="display: block;" class="tab-content default-tab">
						<form action="assignment!save.jspx" method="post">
							<input type="hidden" name="issues.id" value="${issues.id}"/>
							<input type="hidden" name="assignment.id" value="${issues.assignment.id}"/>
							<s:issues_state name="assignment.state" state="${issues.assignment.state}"/>
							<input type="submit" class="button" value="更新" />
						</form>
					</div>       
					
				</div> 
			</div>
			</c:if>
			<div class="content-box column-small-right">
				
				<div class="content-box-header">
					<h3 style="cursor: s-resize;">任务分配　　<c:if test="${issues.assignment.user != null}"> <span style="color:#77BACE">已分配给:${issues.assignment.user.name}</span></c:if></h3>
				</div>
				
				<div class="content-box-content">
					
					<div style="display: block;" class="tab-content default-tab">
						<form action="assignment!userSave.jspx" method="post">
								<c:if test="${issues.assignment != null}">
									<input type="hidden" name="assignment.id" value="${issues.assignment.id}" />
								</c:if>
								<c:if test="${issues.assignment == null}">
									<input type="hidden" name="assignment.id" value="0" />
								</c:if>
								<input type="hidden" name="issues.id" value="${issues.id}"/>
						分配给：<select name="user.id">
									<option value="0">未选择</option>
									<c:forEach items="${issues.project.users}" var="user">
										<c:choose>
											<c:when test="${issues.assignment != null}">
												<c:choose>
													<c:when test="${user.id eq issues.assignment.user.id}">
														<option selected="selected" value="${user.id}">${user.name}</option>
													</c:when>
													<c:otherwise>
														<option value="${user.id}">${user.name}</option>
													</c:otherwise>
												</c:choose>
											</c:when>
											<c:otherwise>
												<option value="${user.id}">${user.name}</option>
											</c:otherwise>
										</c:choose>
									</c:forEach>
								</select>
								<input type="submit" class="button" value="分配"/>
						</form>
					</div>       
				</div> 
			</div>
			<div class="clear"></div>
			<!-- 任务结束 -->
			<%@include file="foot.jsp" %>
		</div>
		<!-- main-content结束 -->
	</div>
</body>
</html>


